// 检测手机号码
var checkTel = (rule, value, callback) => {
  const regTel = /^[1][3,4,5,7,8][0-9]{9}$/;
  if (!value) {
    return callback(new Error('请您输入手机号'));
  } else if (!regTel.test(value)) {
    callback(new Error('请您输入11位正确的手机号'));
  }else {
    callback();
  }
};

// 检测邮箱号码
var checkMail = (rule, value, callback) => {
  const regMail = /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
  
  if (!regMail.test(value) && value ) {
    callback(new Error('请您输入正确的邮箱'));
  }else {
    callback();
  }
};

// 检测QQ号码
var checkQQ = (rule, value, callback) => {
  const regQQ = /^[1-9][0-9]{4,10}$/;
 
  if (!regQQ.test(value)  && value ) {
    callback(new Error('请您输入5-15位正确的qq号码'));
  }else {
    callback();
  }
};



export default {
  checkTel,
  checkMail,
  checkQQ
} 